<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<style>
.pagination>li>input, .pagination>li>select{
	background-color: #FFF;
	border: 1px solid #DDD;
	color: inherit;
	float: left;
	line-height: 1.42857;
	
	margin-left: -1px;
	padding: 4px 10px;
	position: relative;
	text-decoration: none
}
</style>
<div style="text-align:center;">
                        <ul class="pagination">
                       		<li><a>共${page.total}条</a></li>
                       		
                            <c:choose>
                            	<c:when test="${!page.isFirstPage}">
                            	<li onclick="page(${page.firstPage})"><a>首页</a></li>
                                <li onclick="page(${page.prePage})"><a>上一页</a></li>
                            	</c:when>
                            	<c:otherwise>
                            	<li><a>首页</a></li>
                                <li><a>上一页</a></li>
                            	</c:otherwise>
                            </c:choose>
                            
                            <c:forEach items="${page.navigatepageNums}" var="navigatepageNum">
                            	<c:choose>
                            	<c:when test="${navigatepageNum==page.pageNum}">
                            	<li class="active"><a>${navigatepageNum}</a></li>
                            	</c:when>
                            	<c:otherwise>
                            	 <li onclick="page(${navigatepageNum})"><a>${navigatepageNum}</a></li>
                            	</c:otherwise>
                            </c:choose>
                            </c:forEach>
                            
                            
                            <c:choose>
                            	<c:when test="${!page.isLastPage}">
                            	<li onclick="page(${page.nextPage})"><a>下一页</a></li>
                            	<li onclick="page(${page.lastPage})"><a>尾页</a></li>
                            	</c:when>
                            	<c:otherwise>
                            	<li><a>下一页</a></li>
                                <li><a>尾页</a></li>
                            	</c:otherwise>
                            </c:choose>
 							<li><a>第&nbsp;${page.pageNum}/${page.pages}&nbsp;页</a></li>
 							
                        </ul>
                        <ul class="pagination" style="margin-left: 50px">
                         	<li>
 								<select id="pageSize" style="width: 70px" name="pageSize" onchange="search()">
 									<option <c:if test="${page.pageSize == 10}"> selected="selected"</c:if> value="10">10条/页</option>
 									<option <c:if test="${page.pageSize == 50}"> selected="selected"</c:if> value="50">50条/页</option>
 									<option <c:if test="${page.pageSize == 100}"> selected="selected"</c:if> value="100">100条/页</option>
 								</select>
 							</li>
 							<li>
 							<span>跳至</span>
 							<input type="text" style="width:50px;" onchange="pageChange(this)" name="pageNum" id="pageNum" value="${page.pageNum}">
 							<span>页</span>
 							<input type="button" onclick="page($('#pageNum').val())" value="GO"/>
 							</li>
                        </ul>
</div>

<script type="text/javascript">
function pageChange(obj){
	$this = $(obj);
	if (!(/(^[1-9]\d*$)/.test($this.val()))) {
		layer.msg('页数只能是正整数', {icon: 1});
		$this.val('${page.pageNum}');
		return;
	}
}

function page(v){
	if (!(/(^[1-9]\d*$)/.test(v))) {
		layer.msg('页数只能是正整数', {icon: 1});
		return;
	}
	document.getElementById("pageNum").value= v;
	var form = document.getElementById('${param.form}');
	form.submit();
}
function search(){
	var form = document.getElementById('${param.form}');
	form.submit();
}
</script>